package com.example.demo2.entity;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

@Data
@ExcelIgnoreUnannotated
@TableName("sys_customer")
public class Customer {
    @TableId(type = IdType.AUTO)
    @ExcelProperty(value = "编号")
    private Integer id;
    @ExcelProperty(value = "用户名")
    private String username;
    @ExcelProperty(value = "昵称")
    private String nickname;
    @ExcelProperty(value = "头像")
    private String avatar;
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) //密码不返回给前端
    private String password;
    private String token;
    @ExcelProperty(value = "性别")
    private String sex;
    @ExcelProperty(value = "手机")
    private String phone;
    @ExcelProperty(value = "邮箱")
    private String email;
    @TableLogic(value = "0", delval = "1")
//    由于 isDelete 添加了 @TableLogic 注解，MyBatis Plus 做所有查询操作时，自动会在 where 条件后面拼上 is_del = 0，所以 is_del 置一后，实现了逻辑删除
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) //逻辑删除不返回给前端
    private Integer isDelete;
}
